/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pojo;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author alessandro
 */
@Entity
@Table(name = "SERVICO_ORCAMENTO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ServicoOrcamento.findAll", query = "SELECT s FROM ServicoOrcamento s"),
    @NamedQuery(name = "ServicoOrcamento.findByIdServicoOrcamento", query = "SELECT s FROM ServicoOrcamento s WHERE s.idServicoOrcamento = :idServicoOrcamento"),
    @NamedQuery(name = "ServicoOrcamento.findByValor", query = "SELECT s FROM ServicoOrcamento s WHERE s.valor = :valor")})
public class ServicoOrcamento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_servico_orcamento")
    private Integer idServicoOrcamento;
    @Basic(optional = false)
    @NotNull
    @Column(name = "valor")
    private double valor;
    @JoinColumn(name = "cod_agendamento_atendimento", referencedColumnName = "id_agendamento")
    @ManyToOne
    private Agendamento codAgendamentoAtendimento;
    @JoinColumn(name = "cod_servico", referencedColumnName = "id_item")
    @ManyToOne(optional = false)
    private Item codServico;
    @JoinColumn(name = "cod_orcamento", referencedColumnName = "id_orcamento")
    @ManyToOne(optional = false)
    private Orcamento codOrcamento;

    public ServicoOrcamento() {
    }

    public ServicoOrcamento(Integer idServicoOrcamento) {
        this.idServicoOrcamento = idServicoOrcamento;
    }

    public ServicoOrcamento(Integer idServicoOrcamento, double valor) {
        this.idServicoOrcamento = idServicoOrcamento;
        this.valor = valor;
    }

    public Integer getIdServicoOrcamento() {
        return idServicoOrcamento;
    }

    public void setIdServicoOrcamento(Integer idServicoOrcamento) {
        this.idServicoOrcamento = idServicoOrcamento;
    }

    public double getValor() {
        return valor;
    }

    public void setValor(double valor) {
        this.valor = valor;
    }

    public Agendamento getCodAgendamentoAtendimento() {
        return codAgendamentoAtendimento;
    }

    public void setCodAgendamentoAtendimento(Agendamento codAgendamentoAtendimento) {
        this.codAgendamentoAtendimento = codAgendamentoAtendimento;
    }

    public Item getCodServico() {
        return codServico;
    }

    public void setCodServico(Item codServico) {
        this.codServico = codServico;
    }

    public Orcamento getCodOrcamento() {
        return codOrcamento;
    }

    public void setCodOrcamento(Orcamento codOrcamento) {
        this.codOrcamento = codOrcamento;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idServicoOrcamento != null ? idServicoOrcamento.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ServicoOrcamento)) {
            return false;
        }
        ServicoOrcamento other = (ServicoOrcamento) object;
        if ((this.idServicoOrcamento == null && other.idServicoOrcamento != null) || (this.idServicoOrcamento != null && !this.idServicoOrcamento.equals(other.idServicoOrcamento))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pojo.ServicoOrcamento[ idServicoOrcamento=" + idServicoOrcamento + " ]";
    }
    
}
